package com.qian.ddj.web.controller;

import com.qian.api.ddj.model.Spider;
import com.qian.api.ddj.model.SpiderCount;
import com.qian.api.ddj.model.SpiderQueryModel;
import com.qian.api.ddj.service.ISpiderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ddj/spider")
public class SpiderController {

    @Autowired
    private ISpiderService spiderService;

    @GetMapping
    public List<Spider> list(Spider spider) {
        List<Spider> list = spiderService.findAll(spider);
        return list;
    }

    @GetMapping("/count")
    public List<SpiderCount> count(SpiderQueryModel queryModel) {
        List<SpiderCount> spiderCounts = spiderService.count(queryModel);
        return spiderCounts;
    }
}
